package com.lsy.weizhi2.mysql;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by 嗨哟 on 2017/4/19.
 */
public class MySQLiteHelper extends SQLiteOpenHelper {
    private static MySQLiteHelper helper;

    private MySQLiteHelper(Context context) {
        super(context, "weizhi", null, 1);
    }
    public static MySQLiteHelper getInstance(Context context){
        if(helper==null){
            helper=new MySQLiteHelper(context);
        }
        return helper;
    }
    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        String sql="create table IF NOT EXISTS activity (id int,title varchar(20),content Text,name varchar(20),tel Text,create_time Text,email Text,enrollment int,photo Text,avatar int)";
        String sql_1="create table IF NOT EXISTS homegrid (id int, first int, second int, name varchar(10), place int)";
        sqLiteDatabase.execSQL(sql);
        sqLiteDatabase.execSQL(sql_1);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }

}
